package main

import "fmt"

/*
一维的配置数组转为二维的一个区间数组
 */

func main()  {
	arr := []int{6,0,10,20,30}
	//
	total := 0
	for v := range arr {
		//fmt.Println(v)
		total = total + v
	}

	fmt.Printf("total:%v \n", total)
	useNum := 0
	//要让每个数有个区间
	arr2 := make(map[int][]int, 10)
	for k, v := range arr {
		fmt.Println(v)
		arr2[k] = []int{useNum, useNum+v}
		useNum = useNum + v

	}
	//map[0:[0 0] 1:[0 0] 2:[0 10] 3:[10 20] 4:[20 30]]
	fmt.Printf("\n%+v",arr2)


	a := []int{0,1,2}
	fmt.Printf("\n %p",&a)
	a = append(a[:0], a[1:]...)
	fmt.Printf("\n %p",&a)

}

